Page({
  data: {
    orderInfo: {}
  },
  onLoad(options) {
    if (options.orderInfo) {
      try {
        const orderInfo = JSON.parse(decodeURIComponent(options.orderInfo));
        this.setData({ orderInfo });
      } catch (error) {
        console.error('解析订单信息失败:', error);
      }
    }
  },
  viewOrderDetails() {
    const orderInfo = this.data.orderInfo;
    // 跳转到订单详情页并传递订单信息
    wx.navigateTo({ 
      url: `/pages/OrderDetail/OrderDetail?orderInfo=${encodeURIComponent(JSON.stringify(orderInfo))}` 
    });
  },
  goHome() {
    // 返回首页
    wx.reLaunch({ 
      url: '/pages/index/index' 
    });
  }
});